<?php
/**
 * Created by kelow
 * User: Administrator
 * Date: 2025-05-07 11:36:19
 */
namespace app\api\controller;

use app\common\controller\Api;
use app\admin\model\ActivityConfig;
use app\manystore\model\Manystore;

class Activity extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function get_config()
    {
        $uuid = $this->request->post("uuid");
        $manystore = Manystore::where('uuid', $uuid)->find();

        if(empty($manystore)){
            $this->error('请检查配置');
        }
        if(strtotime($manystore['overtime']) < time()){
            $this->error('商家已过期');
        }
        $config = ActivityConfig::with(['manystore2'])->where('shop_id', $manystore['shop_id'])->find();
        $config['logo'] = cdnurl($config['logo'], true);
        $config->hidden(['shop_id,id']);

        if(empty($config)){
            $this->error('商家配置错误');
        }
        $this->success('请求成功',$config);
    }
}